export default {
  Required(options = { message: "不能为空", trigger: ["blur", "change"] }) {
    return [
      { required: true, message: options.message, trigger: options.trigger },
    ];
  },

  // 账号
  Account() {
    return [
      {
        pattern: /^[a-z]{4,10}$/,
        message: "账号仅支持字母，且长度保持在4 ~ 10",
        trigger: ["blur", "change"],
      },
    ];
  },

  // 密码
  Password() {
    return [
      {
        pattern: /^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d]{0,10}$/,
        message: "密码必须含有数字和字母，且长度保持在10以内",
        trigger: ["blur", "change"],
      },
    ];
  },
};
